﻿using Microsoft.AspNetCore.Mvc;
using System.Text.Encodings.Web;

namespace MvcMovie.Controllers
{
    public class HelloController : Controller
    {
        public IActionResult Index()
        {
            ViewData["Name"] = "小明";
            return View();
        }

        //public String Index()
        //{
        //    return "Index首页返回字符串";
        //}
        //public IActionResult Welcome()
        //{
        //    return Content("<h3>这是Welcome方法返回HTML串</ h3>", "text/html;charset=utf-8");
        //}
        public IActionResult Welcome(string name="lz", int n = 1)
        {
            ViewData["Message"] = "Hello " + name;
            ViewData["Count"] = n;
            return View();
        }
        public string WelcomeId(int id)
        {
            return HtmlEncoder.Default.Encode($"id = {id}");
        }
    }
}
